package com.jhz.speedy.common.base;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;

import com.jhz.speedy.common.util.ToastUtils;
import com.jhz.speedy.component.control.MyControl;

/**
 * Activity 基类
 * Created by JunHeZ on 2017/6/27.
 */

public class IBaseActivity extends FragmentActivity{
    protected String TAG = this.getClass().getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);  // 指定竖屏
        MyControl.getActivityManage().add(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        MyControl.getActivityManage().remove(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        MyControl.getActivityManage().setCurrentActivity(this);
    }

    public void showToast(String msg) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }

    public void showToast(int strID) {
        ToastUtils.toast(strID);
    }
}
